<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="main.css" type="text/css" />
<style type="text/css">
.tron{background-color:#FFCC99}
.k=notro{background-color:#FFFFFF}

</style>
</head>
<body>
<?php
include("connect.php");
echo"<center>";
echo"<form name='fcn' action='cnhoadonsl.php' enctype='multipart/form-data' method='post'>";
echo"Cập nhật số lượng mặt hàng <i>(trong hóa đơn nhập)</i>";
echo"<br> <input type ='text' name='soluong', size=10 />";
echo"    <input type='submit' name ='cnsoluong' value='OK'/>";
echo"</form>";

echo"</center>";

if($_REQUEST['cnsoluong']!="")
{
?>

<style type="text/css">
<!--
.style2 {color: #0000CC}
-->
</style>
<center>
<form action="cnhang.php" method="post" enctype="multipart/form-data" name="cnh">

<table width="600" border="0">
  <tr>
    <td   colspan="2"  align="center"bgcolor="#339999"><b>Cập nhật Danh mục trên hóa đơn</b></td>
   
  </tr>
   <tr>
    <td colspan="2" bgcolor="#1a3600" height="5"></td>
    
  </tr>
  <tr>
    <td width="400">Mã nhân viên </td>
    <td><select name="manv">
	<?php
	$kqnv=mysql_query("select * from nhanvien",$link);
	while($rnv=mysql_fetch_array($kqnv))
		{ $manv=$rnv[0];
			echo"<option>$manv</option>";
		}
	
	?>
    
    </select>
    </td>
  </tr>
   <tr>
    <td>Ngày nhập</td>
    <td><input type="text" name="ngaynhap" value="<?php echo date('d/m/Y');?>"/></td>
  </tr>
   <tr>
    <td></td>
    <td>&nbsp;</td>
  </tr>
    <tr>
    <td colspan="2" bgcolor="#FF3300" height="5"></td>
	</tr>
</table>




<table width="1000" border="1">
  <tr bgcolor="#3366CC">
    <td bordercolor="#336699" bgcolor="#FF99FF"><div align="center"><strong><span class="style2">Mã hàng </span></strong></div></td>
    <td bordercolor="#336699" bgcolor="#FF99FF"><div align="center"><strong><span class="style2">Tên hàng </span></strong></div></td>
    <td bordercolor="#336699" bgcolor="#FF99FF"><div align="center"><strong><span class="style2">Nhà CC </span></strong></div></td>
    <td bordercolor="#336699" bgcolor="#FF99FF"><div align="center"><strong><span class="style2">Loại hàng </span></strong></div></td>
    <td bordercolor="#336699" bgcolor="#FF99FF"><div align="center"><strong><span class="style2">Đơn vị tính </span></strong></div></td>
    <td bordercolor="#336699" bgcolor="#FF99FF"><div align="center"><strong><span class="style2">Đơn giá </span></strong></div></td>
    <td bordercolor="#336699" bgcolor="#FF99FF"><div align="center"><strong><span class="style2">Số lượng </span></strong></div></td>
    <td bordercolor="#336699" bgcolor="#FF99FF"><div align="center"><strong><span class="style2">Hình</span></strong></div></td>
    <td bordercolor="#336699" bgcolor="#FF99FF"><div align="center"><strong><span class="style2">Ghi chú </span></strong></div></td>
  </tr>
  <tr>
  <?php
	$sl=$_REQUEST['soluong'];
	
	for($i=0;$i<$sl;$i++)
	{
	//		$_SESSION[$i]['mahang'];
		echo"<td><input name='mahang$i' type='text' id='mahang' size='15'onfocus='this.className=\"tron\"' onblur='this.className=\"notron\" '/></td>";
		echo"<td><input name='tenhang$i' type='text' id='tenhang' size='50' onfocus='this.className=\"tron\"' onblur='this.className=\"notron\"'/></td>";
	$sqlncc="select * from nhacc";
	$sqlloai="select * from loaihang";
	$kqloai=mysql_query($sqlloai,$link);
	$kqncc=mysql_query($sqlncc,$link);
		echo"<td><select name='mancc$i' id='mancc'>";
		while($rncc=mysql_fetch_array($kqncc))
		{	$tam=$rncc['mancc'];
			echo"<option>$tam</option>";
			}
		echo"</select>";
		echo" </td>";

		echo" <td><select name='maloai$i' id='maloai' >";
		while($rloai=mysql_fetch_array($kqloai))
		{	$tam=$rloai['maloai'];
			echo"<option>$tam</option>";
			}
		echo"</select>";
		echo"</td>";
		echo"<td><input name='dvt$i' type='text' id='dvt' size='15' onfocus='this.className=\"tron\"' onblur='this.className=\"notron\"'/></td>";
		echo"<td><input name='dongia$i' type='text' id='dongia' size='15'onfocus='this.className=\"tron\"' onblur='this.className=\"notron\"'/></td>";
		echo"<td><input name='soluong$i' type='text' id='soluong' size='8'onfocus='this.className=\"tron\"' onblur='this.className=\"notron\" '/></td>";
		echo"<td><input name='hinh$i' type='file' id='hinh' /></td>";
		echo"<td>&nbsp;</td>";
	
	echo"</tr>";
	}
echo"</table>";
echo"<input type='hidden' name='slhang' value='$sl'/>";
echo"<input type='submit' name='cnok' value='  Cập nhật  '/>";
echo"</form>";
}
echo"</center>";

?>

</body>
</html>
